import request from '@/router/axios';
import config from '@/config/website'

//项目变更分页列表
export const getChangePage = (current, size, params) => {
    return request({
        url: '/api/hg-public/changelist/page',
        method: 'get',
        params: {
            current, size,
            ...params,
        }
    })
}
//更新 
export const updateChange = (row) => {
    return request({
        url: '/api/hg-public/changelist/submit',
        method: 'post',
        data: row
    })
}
//获取详情
export const getChange = (id) => {
    return request({
        url: '/api/hg-public/changelist/detail',
        method: 'get',
        params: {
            id
        }
    })
}

//删除 
export const removeChange = (ids) => {
    return request({
        url: '/api/hg-public/changelist/remove',
        method: 'post',
        params: {
            ids,
        }
    })
}
//获取任务阶段下的任务
export const getPhasesTask = (params) => {
    return request({
        url: '/api/hg-public/changelist/getPhasesTask',
        method: 'get',
        params: {
            ...params
        }
    })
}
//获取阶段任务下的apqp文件
export const getTaskApqpFile = (params) => {
    return request({
        url: '/api/hg-public/changelist/getTaskApqpFile',
        method: 'get',
        params: {
            ...params
        }
    })
}

//获取阶段任务下的计划
export const getTaskPlan = (params) => {
    return request({
        url: '/api/hg-public/changelist/getTaskPlan',
        method: 'get',
        params: {
            ...params
        }
    })
}
//提交
export const submitChange = (changeListId) => {
    return request({
      url: '/api/hg-public/changelist/start-process',
      method: 'get',
      params: {
        changeListId,
      }
    })
  }
//列表导出
export const changeExport = () => {
    window.location = `${config.exportUrl}/hg-public/changelistrecord/exportRecord`;
}

//项目变更记录分页列表
export const getChangeRecordPage = (current, size, params) => {
    return request({
        url: '/api/hg-public/changelistrecord/page',
        method: 'get',
        params: {
            current, size,
            ...params,
        }
    })
}